package com.taplinker.client.domain;

public class MenuDomain {
	public enum MenuItems{
		PUBLIC(0), PRIVATE(1), CRM(2), ACCOUNT(3);
		
		private int itemNo;
		MenuItems (int itemNo) {
			this.itemNo = itemNo;
		}
		public int getItemNo() {
			return itemNo;
		}
	}
	
	private static boolean[] menus = new boolean[]{false, false, false, false};
	
	private static boolean[] menuClickable = new boolean[]{true, true, true, true};
	
	public static void resetMenu() {
		menus[0] = false;
		menus[1] = false;
		menus[2] = false;
		menus[3] = false;
	}
	
	public static void resetMenuClickable() {
		menuClickable[0] = true;
		menuClickable[1] = true;
		menuClickable[2] = true;
		menuClickable[3] = true;
	}
	
	public static void open(MenuItems muItem) {
		resetMenu();
		if(muItem.getItemNo() < menus.length) {
			menus[muItem.getItemNo()] = true;
		}
	}
	
	public static boolean isOpen(MenuItems muItem) {
		if(muItem.getItemNo() < menus.length) {
			return menus[muItem.getItemNo()];
		} else {
			return false;
		}
	}
	
	public static boolean isClickable(MenuItems muItem) {
		if(muItem.getItemNo() < menuClickable.length) {
			return menuClickable[muItem.getItemNo()];
		} else {
			return false;
		}
	}
	
	public static void setUnclickable(MenuItems muItem) {
		if(muItem.getItemNo() < menuClickable.length) {
			menuClickable[muItem.getItemNo()] = false;
		}
	}
	
}
